import { create } from '../lib/my-zustand';

function logMiddleware(func) {
  return function(set, get, store) {

    function newSet(...args) {
      console.log('调用了 set：', get());

      return set(...args);
    }

    return func(newSet, get, store);

  }
}

export const useXxxStore = create(logMiddleware((set) => ({
  aaa: '',
  bbb: '',
  updateAaa: (value) => set({ aaa: value }),
  updateBbb: (value) => set({ bbb: value }),
})));
